/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
//
package edu.asu.cse360.client.action;

import edu.asu.cse360.client.context.RestaurantContext;
import edu.asu.cse360.context.ServiceFactory;
import edu.asu.cse360.model.Table;
import edu.asu.cse360.model.TableStatus;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.JOptionPane;

/**
 * This class is used when the help button is pressed by the customer and tells the waitperson that the table needs assistance
 * @author nadimhoque
 */
public class CallForAssistanceAction extends AbstractAction{
    
    public CallForAssistanceAction(){
        super("Call for assistance");
    }

    public void actionPerformed(ActionEvent e) {
        Table table = RestaurantContext.getTable();
        table.setStatus(TableStatus.NEEDS_ASSISTANCE);
        ServiceFactory.getTableService().save(table);
        JOptionPane.showMessageDialog(null, "A waitperson will be with you shortly.");
    }

}
